package org.dromara.starter.jpacomment.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;

public interface JpacommentMapper extends BaseMapperPlus {

    // SAIl ${}和#{}=>''
    @Update("ALTER TABLE ${schema}.${tableName} COMMENT = #{tableComment}")
    int alterTableComment(@Param("schema") String schema, @Param("tableName") String tableName, @Param("tableComment") String tableComment);

    @Update("ALTER TABLE ${schema}.${tableName} MODIFY COLUMN ${columnName} ${columnType} ${nullable} DEFAULT ${defaultValue} COMMENT #{columnComment}")
    int alterUpdateColumn(@Param("schema") String schema, @Param("tableName") String tableName, @Param("columnName") String columnName, @Param("columnType") String columnType, @Param("nullable") String nullable,@Param("defaultValue") String defaultValue, @Param("columnComment") String columnComment);

    @Update("ALTER TABLE ${schema}.${tableName} ADD ${indexType} INDEX ${indexName}(${columnName})")
    int alterAddIndex(@Param("schema") String schema, @Param("tableName") String tableName, @Param("indexType") String indexType, @Param("indexName") String indexName, @Param("columnName") String columnName);

}
